<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">123</div>
    <div class="box">456</div>

    <ul>
        <li>测试1</li>
        <li>测试2</li>
        <li>测试3</li>
    </ul>

    <div class="navigation">导航栏</div>

    <script>
        // 默认获取第一个匹配的元素
        const box = document.querySelector('.box')
        console.log(box);
        const thirdLi = document.querySelector('ul li:nth-child(2)')
        console.log(thirdLi);
        // 这个方法获取的是伪数组
        const allBox = document.querySelectorAll('ul li')
        console.log(allBox);
        // 修改元素的样式
        const navigation = document.querySelector('.navigation')
        navigation.style.color = 'red'
        // console.log(navigation);
    </script>
</body>
</html>